﻿using CxRomos.Core.Domain.Entities;
using FluentNHibernate.Mapping;

namespace CxRomos.Core.Domain.Mappings {
    public class ProfileMap : ClassMap<Profile> {
        public ProfileMap() {
            Table("[dbo].[Profiles]");
            OptimisticLock.Version();
            LazyLoad();

            Id(x => x.AccountId)    
                .Column("AccountId")
                .GeneratedBy.Assigned();

            Map(x => x.ProfileId).ReadOnly().Column("ProfileId");
            Map(x => x.CreateDate);
            Map(x => x.LastUpdateDate);
            Map(x => x.ProfileName);
            Map(x => x.IM);
            Map(x => x.IMSkype);
            Map(x => x.Signature);
            Map(x => x.Avatar).CustomSqlType("VARBINARY(MAX)");
            Map(x => x.AvatarMimeType);
        }
    }
}